package com.housekeeping.housekeeping.administrator.adminsinformation.dao.impl;

import com.housekeeping.housekeeping.administrator.adminsinformation.dao.DeleteDao;
import com.housekeeping.housekeeping.administrator.utils.Dbmanage;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class DeleteDaoImpl implements DeleteDao {
    @Override
    public int delete(int id) {
        Connection connection=null;
        Statement statement=null;
        int count = 0;
        try {
            connection= Dbmanage.getConnection();
            statement=connection.createStatement();
            count=statement.executeUpdate("UPDATE admins_information SET is_del = 1 WHERE id="+id);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            Dbmanage.close(connection,statement);
        }
        return count;
    }
}
